package com.xneure.enging.event;

import java.util.LinkedHashMap;
import java.util.Map;

import com.xneure.enging.bean.WebEventResult;
import com.xneure.enging.event.Notify.NotifyType;
import com.xneure.utils.bean.GUID;

public abstract class EventNotify {

	protected Map<GUID, WebEventResult> eventRes;

	public Map<GUID, WebEventResult> getEventResult() {
		return eventRes;
	}

	public void trigger(NotifyType type, String name, Object val, GUID target) {
		if (eventRes == null) {
			eventRes = new LinkedHashMap<GUID, WebEventResult>(10);
		}
		WebEventResult map = eventRes.get(target);
		if (map == null) {
			map = new WebEventResult(target);
			eventRes.put(target, map);
		}
		map.setProperty(type, name, val);
	}
	public void initRes(){
		if (eventRes != null) {
			eventRes.clear();
		}
	}
	public abstract void activate(NotifyType type, String name, Object val, GUID target);
}
